// Takes earth-weight and prints table of weights on all planets - Page 150
package org.effectivejava.examples.chapter06.item30;

/**
 * 打印出行星（枚举类）的表格
 * 1、枚举的静态方法values()，按照声明顺序返回值数组
 * 2、枚举的toString()方法，返回每个声明的名称
 */
public class WeightTable {
	public static void main(String[] args) {
		double earthWeight = 175; // 书本上取175
		// double earthWeight = Double.parseDouble(args[0]);
		double mass = earthWeight / Planet.EARTH.surfaceGravity();
		// 根据某个物体在地球上的重量计算出该物体在其他行星上的质量
		for (Planet p : Planet.values())
			System.out.printf("Weight on %s is %f%n", p, p.surfaceWeight(mass));
	}
}
